package com.rock.code.base.service;

import com.github.pagehelper.PageInfo;
import com.rock.code.common.pager.Page;

import java.util.List;
import java.util.Map;

/**
 * The interface Base service.
 *
 * @param <T> the type parameter
 * @author kongqiang
 * @date 2017.03.30
 */
public interface BaseService<T> {

    /**
     * Insert.
     *
     * @param t the t
     * @return the int
     * @throws Exception the exception
     * @author kongqiang
     * @date 2017.03.30
     */
    int insert(T t) throws Exception;

    /**
     * Delete.
     *
     * @param primaryKey the primary key
     * @return the int
     * @throws Exception the exception
     * @author kongqiang
     * @date 2017.03.30
     */
    int delete(String primaryKey) throws Exception;

    /**
     * Delete by param.
     *
     * @param param the param
     * @return the int
     * @throws Exception the exception
     * @author kongqiang
     * @date 2017.04.01
     */
    int deleteByParam(Map<String, Object> param) throws Exception;

    /**
     * Update.
     *
     * @param t the t
     * @return the int
     * @throws Exception the exception
     * @author kongqiang
     * @date 2017.03.30
     */
    int update(T t) throws Exception;

    /**
     * Query.
     *
     * @param t the t
     * @return the t
     * @throws Exception the exception
     * @author kongqiang
     * @date 2017.03.30
     */
    T query(T t) throws Exception;

    /**
     * Query by para map.
     *
     * @param param the param
     * @return the t
     * @throws Exception the exception
     * @author kongqiang
     * @date 2017.03.30
     */
    T queryByParaMap(Map<String, Object> param) throws Exception;

    /**
     * Query list.
     *
     * @param t the t
     * @return the list
     * @throws Exception the exception
     * @author kongqiang
     * @date 2017.03.30
     */
    List<T> queryList(T t) throws Exception;

    /**
     * Query list by para map.
     *
     * @param param the param
     * @return the list
     * @throws Exception the exception
     * @author kongqiang
     * @date 2017.03.30
     */
    List<T> queryListByParaMap(Map<String, Object> param) throws Exception;

    /**
     * Query page list.
     *
     * @param param the param
     * @return the page info
     * @throws Exception the exception
     * @author kongqiang
     * @date 2017.03.30
     */
    PageInfo<T> queryPageList(Page page, Map<String, Object> param) throws Exception;

    /**
     * Query list by order.
     *
     * @param page  the page
     * @param param the param
     * @return the list
     * @throws Exception the exception
     * @author kongqiang
     * @date 2018.01.02
     */
    List<T> queryListByOrder(Page page, Map<String, Object> param) throws Exception;



}
